home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / wmsPlugins.inc < prev    next >
Encoding:
Text File  |  2003-02-21  |  9.0 KB  |  275 lines

  1. ∩╗┐<!--#include file="wmsConstants.inc"-->
  2. <!--#include file="wmsCommon.inc"-->
  3. <!--#include file="wmsConnect.inc"-->
  4. <!--#include file="wmsHelp.inc"-->
  5. <%
  6. '+-------------------------------------------------------------------------
  7. '
  8. '  Microsoft Windows Media
  9. '  Copyright (C) Microsoft Corporation. All rights reserved.
  10. '
  11. '  File:       plugins.inc
  12. '
  13. '  Contents:
  14. '
  15. '--------------------------------------------------------------------------
  16.  
  17. Dim g_objPluginCollection
  18. Dim g_objPlugin
  19. Dim g_objPluginAdmin
  20. Dim g_strPluginName
  21.  
  22. Dim g_strCategory
  23. Dim g_strSubCategory
  24. Dim g_strPluginIndexInCategory
  25. Dim g_strEncodedInstance
  26. Dim g_strDecodedInstance
  27. Dim g_dwPluginCount
  28.  
  29. dwTabIndex = 1
  30.  
  31. ConnectToServer
  32. ConnectToPubPoint
  33.  
  34. g_objPluginCollection = empty
  35. g_objPlugin = empty
  36. g_objPluginAdmin = empty
  37. g_strPluginName = empty
  38.  
  39. g_strEncodedInstance = GetPostOrQsVal( "instance" )
  40. g_strDecodedInstance = SafeUnescape( g_strEncodedInstance )
  41. g_strCategory = GetPostOrQsVal( "category" )
  42. g_strReferrer = GetPostOrQsVal( "referrer" )
  43.  
  44. '///////////////////////////
  45. Function GetFormStr( strKey )
  46.     GetFormStr = trim( CStr( posting( strKey ) ) )
  47. End Function
  48.  
  49. '///////////////////////////
  50. Function GetFormDbl( strKey )
  51.     Dim strTmp
  52.     strTmp = trim( CStr( posting( strKey ) ) )
  53.     if( 0 < Len( strTmp ) ) then
  54.         GetFormDbl = CDbl( strTmp )
  55.     else
  56.         GetFormDbl = 0
  57.     end if
  58. End Function
  59.  
  60. '///////////////////////////
  61. Function GetPostOrQsVal( strKey )
  62.  
  63.     Dim strVal    
  64.     strVal = CStr( posting( strKey ) )
  65.     
  66.     if( 0 = Len( strVal ) ) then
  67.         strVal = CStr( qs( strKey ) )
  68.     end if
  69.     
  70.     GetPostOrQsVal = strVal
  71.  
  72. End Function
  73.  
  74. '///////////////////////////
  75. Sub ConnectToPlugin    
  76.     '
  77.     '  If it looks like we're connecting to a particular publishing point, then
  78.     '   assign objPubPointOrServer to the pub point
  79.     '
  80.     Dim objPubPointOrServer
  81.     Set objPubPointOrServer = g_objServer
  82.     if( FALSE = IsEmpty( g_objPubPoint ) ) then
  83.         Set objPubPointOrServer = g_objPubPoint
  84.     end if
  85.  
  86.     Select Case g_strCategory
  87.         case CAT_AUTHORIZE
  88.             Set g_objPluginCollection = objPubPointOrServer.EventHandlers
  89.             g_strSubCategory = AUTHORIZE_SUBCAT
  90.         case CAT_LOGGING
  91.             Set g_objPluginCollection = objPubPointOrServer.EventHandlers
  92.             g_strSubCategory = LOGGING_SUBCAT
  93.         case CAT_EVENT
  94.             Set g_objPluginCollection = objPubPointOrServer.EventHandlers
  95.         case CAT_AUTHEN
  96.             Set g_objPluginCollection = objPubPointOrServer.Authenticators
  97.         case CAT_CPROT
  98.             Set g_objPluginCollection = objPubPointOrServer.ControlProtocols
  99.         case CAT_PLAYXFORM
  100.             Set g_objPluginCollection = objPubPointOrServer.EventHandlers
  101.             g_strSubCategory = PLAYLISTXFORM_SUBCAT
  102.         case CAT_MPARS
  103.             Set g_objPluginCollection = objPubPointOrServer.MediaParsers
  104.         case CAT_PLPARS
  105.             Set g_objPluginCollection = objPubPointOrServer.PlaylistParsers
  106.         case CAT_DSRC
  107.             Set g_objPluginCollection = objPubPointOrServer.DataSources
  108.         case CAT_CACHE
  109.             Set g_objPluginCollection = objPubPointOrServer.CacheProxy
  110.         case CAT_ARCH
  111.             Set g_objPluginCollection = objPubPointOrServer.BroadcastDataSinks
  112.             g_strSubCategory = ARCHIVER_SUBCAT
  113.         case CAT_UCAST
  114.             Set g_objPluginCollection = objPubPointOrServer.UnicastDataSinks
  115.         case CAT_MCAST
  116.             if objPubPointOrServer.name = g_objServer.name then
  117.                 Set g_objPluginCollection = objPubPointOrServer.UnicastDataSinks
  118.             else
  119.                 Set g_objPluginCollection = objPubPointOrServer.BroadcastDataSinks
  120.                 g_strSubCategory = MULTICAST_SUBCAT
  121.             end if 
  122.         case Else
  123.             g_strCategory = L_UNKNOWN_TEXT
  124.             g_strSubCategory = L_UNKNOWN_TEXT
  125.     End Select
  126.  
  127.     if( FALSE = IsEmpty( g_objPluginCollection ) ) then
  128.         g_dwPluginCount = g_objPluginCollection.Count
  129.     else
  130.         g_dwPluginCount = 0
  131.     end if
  132.  
  133.     if( 0 < g_dwPluginCount ) then
  134.         strPluginIndex = qs( "pluginIndex" )
  135.         g_strPluginIndexInCategory = Right( strPluginIndex, Len( strPluginIndex ) - 8 + 1 )
  136.         Set g_objPlugin = g_objPluginCollection( g_strPluginIndexInCategory )
  137.         g_strDecodedInstance = g_objPlugin.Name
  138.         g_strEncodedInstance = SafeEscape( g_strDecodedInstance )
  139.     end if
  140.  
  141.     if( empty <> g_objPlugin ) then
  142.         g_strPluginName = g_objPlugin.Name
  143.     else
  144.         g_strPluginName = "??"
  145.     end if
  146. end Sub
  147.  
  148.  
  149. '///////////////////////////
  150. Sub ConnectToPluginAdmin()
  151.     on error resume next
  152.     
  153.     if( TRUE = IsEmpty( g_objPlugin ) ) then
  154.         ConnectToPlugin
  155.     end if
  156.  
  157.     if( FALSE = IsEmpty( g_objPlugin ) ) then
  158.         Set g_objPluginAdmin = g_objPlugin.CustomInterface
  159.     end if
  160. End Sub
  161.  
  162.  
  163. '///////////////////////////
  164. Sub WritePluginJSUtils()
  165.     Dim strEncodedPluginName
  166.     Dim strExtraArgs
  167.     strExtraArgs = ""
  168.     strEncodedPluginName = SafeEscape( g_strPluginName ) 
  169.     if( 0 < Len( GetPostOrQsVal("pendingOp") ) ) then 
  170.         strExtraArgs = "&pendingOp=" & GetPostOrQsVal( "pendingOp" )
  171.     end if
  172. %>
  173. <script language="JavaScript" src="include/WMSCommon.js"></script>
  174. <script language="JavaScript">
  175. <!--
  176. /*@cc_on @*/
  177.  
  178. var g_bSubmittedForm = false;
  179.  
  180. <% WriteCommonJSUtils %>
  181.  
  182. ///////////////////////////
  183. function DoPluginHelp( szHelpTopic )
  184. {
  185.     <% jsTRY %>
  186.     DoHelp( "/", szHelpTopic );
  187.     <% jsCATCH %>
  188. }
  189.  
  190. ///////////////////////////
  191. function ValidateInput()
  192. {
  193.     <% jsTRY %>
  194.         if( true == g_bSubmittedForm )
  195.         {
  196.     <% if( brMSIE = g_dwBrowserType ) then %>
  197.             if( window.event )
  198.             {
  199.                 window.event.cancelBubble = true;
  200.             }
  201.     <% end if %>
  202.             document.pluginForm.ok.disabled = true;
  203.             return( false );
  204.         }
  205.  
  206.         if( document.pluginForm.ok.disabled )
  207.         {
  208.     <% if( brMSIE = g_dwBrowserType ) then %>
  209.             event.cancelBubble = true;
  210.     <% end if %>
  211.             return( false );
  212.         }
  213.         
  214.         g_bSubmittedForm = true;
  215.         return( true );
  216.     <% jsCATCH %>
  217. }
  218.  
  219. ///////////////////////////
  220. function Cancel()
  221. {
  222.     <% jsTRY %>
  223. <% if 0 < Len( g_strReferrer ) then %>
  224.         document.location = "<%= URLDecode( SafeUnescape( g_strReferrer ) ) %>?server=<%= g_strQueryStringServer %>&ppID=<%= g_strPubPointID %>&category=<%= g_strCategory %>&pluginIndex=plugin_<%= g_strPluginIndexInCategory %>&instance=<%= strEncodedPluginName %><%= strExtraArgs %>";
  225. <% elseif 0 < Len( g_strPubPointName ) then %>
  226.         document.location = "../pubpoints/pubpoint_props.asp?server=<%= g_strQueryStringServer %>&ppID=<%= g_strPubPointID %>&category=<%= g_strCategory %>&pluginIndex=plugin_<%= g_strPluginIndexInCategory %>&instance=<%= strEncodedPluginName %><%= strExtraArgs %>";
  227. <% else %>
  228.         document.location = "../server_props.asp?server=<%= g_strQueryStringServer %>&category=<%= g_strCategory %>&pluginIndex=plugin_<%= g_strPluginIndexInCategory %>&instance=<%= strEncodedPluginName %><%= strExtraArgs %>";
  229. <% end if %>
  230.     <% jsCATCH %>
  231. }
  232. -->
  233. </script>
  234. <%
  235. End Sub
  236.  
  237. '///////////////////////////
  238. Sub WriteStdPluginForm()
  239. %>
  240.         <form name="pluginForm" method="POST" action="<%= RemoveDangerousCharacters( g_strQueryString ) %>" onsubmit="JavaScript:window.status='';return( ValidateInput() );" AUTOCOMPLETE="OFF">
  241.         <input type="hidden" name="server" value="<%= RemoveSpecifiedChars( g_strQueryStringServer, "\f|\n|\r|<|>" ) %>">
  242.         <input type="hidden" name="ppID" value="<%= RemoveSpecifiedChars( g_strPubPointID, "\f|\n|\r|<|>" ) %>">
  243.         <input type="hidden" name="category" value="<%= RemoveSpecifiedChars( g_strCategory, "\f|\n|\r|<|>" ) %>">
  244.         <input type="hidden" name="pluginIndex" value="plugin_<%= RemoveSpecifiedChars( g_strPluginIndexInCategory, "\f|\n|\r|<|>" ) %>">
  245.         <input type="hidden" name="instance" value="<%= RemoveSpecifiedChars( g_strDecodedInstance, "\f|\n|\r|<|>" ) %>">
  246.         <input type="hidden" name="referrer" value="<%= RemoveSpecifiedChars( g_strReferrer, "\f|\n|\r|<|>" ) %>"><%
  247.         if 0 < Len( GetPostOrQsVal("pendingOp") ) then %>
  248.         <input type="hidden" name="pendingOp" value="<%= RemoveSpecifiedChars( GetPostOrQsVal("pendingOp"), "\f|\n|\r|<|>" ) %>"><%
  249.         end if %>
  250.         <input type="hidden" name="submit" value="apply">
  251. <%
  252. End Sub
  253.  
  254. '///////////////////////////
  255. '
  256. ' Free the various globals we created by server-side-including this file
  257. '
  258. Sub PluginsASPCleanup
  259.     on error resume next
  260.     WMSConnectASPCleanup
  261.     
  262.     g_objPluginCollection = nothing
  263.     g_objPlugin = nothing
  264.     g_objPluginAdmin = nothing
  265.     g_strPluginName = nothing
  266.  
  267.     g_strCategory = nothing
  268.     g_strSubCategory = nothing
  269.     g_strPluginIndexInCategory = nothing
  270.     g_strEncodedInstance = nothing
  271.     g_strDecodedInstance = nothing
  272.     g_dwPluginCount = nothing
  273. End Sub
  274. %>
  275.